feat(Snowflake): Add Snowflake dialect#9
Open
khvn26 wants to merge 6 commits into
Open
Conversation
Adds the repo plumbing the rest of the branch builds on:
- pyproject (uv build backend, mypy strict, 100% branch coverage gate,
clickhouse-connect dev dep)
- Makefile (install / lint / typecheck / test)
- pre-commit (ruff, uv-lock, flagsmith-lint-tests, local mypy)
- GitHub Actions CI: lint → typecheck → ClickHouse docker-compose →
test → cobertura coverage gate
- engine-test-data submodule pinned at v3.7.0
- docker-compose for the ClickHouse parity harness
- CODEOWNERS, renovate, .python-version, gitignore additions
- py.typed marker and empty package skeleton
beep boop
beep boop
3 tasks
|
Minimum allowed coverage is Generated by 🐒 cobertura-action against 67cc1ed |
87fea78 to
67cc1ed
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Contributes to Flagsmith/flagsmith#5663.
Initial scaffold for
flagsmith-sql-flag-engine— sibling toflagsmith-flag-engine(Python) andflagsmith-rust-flag-engine(Rust). TranslatesSegmentContextpredicate trees into SQLWHEREexpressions.The translator emits a predicate that runs against a single
IDENTITIEStable aliasedi; trait-bound conditions become path-extractable lookups via the activeDialect. Snowflake reads from aVARIANTcolumn, but the translator never assumes that storage shape.PERCENTAGE_SPLITand:semver-marked comparators compile to inline pure-SQL.Public API
EnvironmentContext.keyis used directly as theenvironment_idliteral in emitted SQL — no separate integer PK.IDENTITIESholds aSTRING environment_idcolumn matching the engine's vocabulary.What's included
src/layout,py.typedDialectprotocol withSnowflakeDialectimplementation; regex-flavour gating lives on the dialect viaregex_supports, so future engines aren't forced into RE2's restricted feature setv3.7.0DialectTestHarness; new dialects extend by writing one harness module undertests/harnesses/src/andtests/SNOWFLAKE_*secrets; 100% line + branch coverage gate via Cobertura* @flagsmith/flagsmith-back-end, mirroring the Python engineOperator coverage
EQUAL,NOT_EQUAL,INIS_SET,IS_NOT_SETtraits:"<key>" IS NOT NULL/IS NULLCONTAINS,NOT_CONTAINSGREATER_THAN,LESS_THANplus_INCLUSIVEMODULOPERCENTAGE_SPLITREGEX:semver-marked comparatorsPerformance
Measured on
COMPUTE_WHX-Small, query result cache disabled, warehouse SUSPENDed before each timed query so reads come off remote storage rather than warehouse-local SSD:%SplitThe
%Splitrow above hashes on the implicit$.identity.keysubject and so doesn't read traits; aPERCENTAGE_SPLITagainst a trait property pays the per-row trait-read cost on top of the hash. Warehouse-scaling is roughly linear in warehouse size — divide the X-Small numbers by the warehouse-size multiplier for an estimate.